}
depth = s->get_bpp(s);
- if (depth == 24)
- depth = 32;
if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth)
s->ds->dpy_colourdepth(s->ds, depth);
if (width != s->last_width || height != s->last_height ||
vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)];
depth = s->get_bpp(s);
- if (depth == 24)
- depth = 32;
- if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth)
- s->ds->dpy_colourdepth(s->ds, depth);
+ if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth) {
+ if (depth != 24 || s->ds->depth != 32)
+ s->ds->dpy_colourdepth(s->ds, depth);
+ }
if (disp_width != s->last_width ||
height != s->last_height) {
dpy_resize(s->ds, disp_width, height);
s->last_height = height;
full_update = 1;
}
- if (s->cursor_invalidate)
+ if (s->ds->shared_buf && s->ds->data != s->vram_ptr + (s->start_addr * 4))
+ s->ds->data = s->vram_ptr + (s->start_addr * 4);
+ if (!s->ds->shared_buf && s->cursor_invalidate)
s->cursor_invalidate(s);
line_offset = s->line_offset;
page_min = page0;
if (page_max == 0 || page1 > page_max)
page_max = page1;
- vga_draw_line(s, d, s->vram_ptr + addr, width);
- if (s->cursor_draw_line)
- s->cursor_draw_line(s, d, y);
+ if (!s->ds->shared_buf) {
+ vga_draw_line(s, d, s->vram_ptr + addr, width);
+ if (s->cursor_draw_line)
+ s->cursor_draw_line(s, d, y);
+ }
} else {
if (y_start >= 0) {
/* flush to display */
void *opaque;
int switchbpp;
+ int shared_buf;
void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
void (*dpy_resize)(struct DisplayState *s, int w, int h);
static void vnc_dpy_resize(DisplayState *ds, int w, int h)
{
+ static int allocated;
int size_changed;
VncState *vs = ds->opaque;
int o;
- ds->data = realloc(ds->data, w * h * vs->depth);
+ if (!ds->shared_buf) {
+ if (allocated)
+ ds->data = realloc(ds->data, w * h * vs->depth);
+ else
+ ds->data = malloc(w * h * vs->depth);
+ allocated = 1;
+ } else if (allocated) {
+ free(ds->data);
+ allocated = 0;
+ }
vs->old_data = realloc(vs->old_data, w * h * vs->depth);
vs->dirty_row = realloc(vs->dirty_row, h * sizeof(vs->dirty_row[0]));
vs->update_row = realloc(vs->update_row, h * sizeof(vs->dirty_row[0]));
VncState *vs = ds->opaque;
int updating_client = 1;
+ if (ds->shared_buf) {
+ framebuffer_set_updated(vs, dst_x, dst_y, w, h);
+ return;
+ }
+
if (src_x < vs->visible_x || src_y < vs->visible_y ||
dst_x < vs->visible_x || dst_y < vs->visible_y ||
(src_x + w) > (vs->visible_x + vs->visible_w) ||
vs->blue_shift = blue_shift;
vs->blue_max = blue_max;
vs->pix_bpp = bits_per_pixel / 8;
-
- vga_hw_invalidate();
- vga_hw_update();
}
static void pixel_format_message (VncState *vs) {
static void vnc_dpy_colourdepth(DisplayState *ds, int depth)
{
int host_big_endian_flag;
- struct VncState *vs;
-
- if (!depth) return;
-
+ struct VncState *vs = ds->opaque;
+
+ switch (depth) {
+ case 24:
+ ds->shared_buf = 0;
+ depth = 32;
+ break;
+ case 0:
+ ds->shared_buf = 0;
+ return;
+ default:
+ ds->shared_buf = 1;
+ break;
+ }
+
#ifdef WORDS_BIGENDIAN
host_big_endian_flag = 1;
#else
host_big_endian_flag = 0;
-#endif
- vs = ds->opaque;
+#endif
switch (depth) {
case 8:
vs->ds->width = 640;
vs->ds->height = 400;
- vnc_dpy_colourdepth(vs->ds, 32);
+ vnc_dpy_colourdepth(vs->ds, 24);
}
#if CONFIG_VNC_TLS